import vue from '@vitejs/plugin-vue';
import vueJsx from '@vitejs/plugin-vue-jsx';
import { defineConfig } from 'vite';
import dts from 'vite-plugin-dts';

// https://vitejs.dev/config/
export default defineConfig({
  build: {
    lib: {
      entry: 'src/components/index.ts',
      fileName: (format) => `svg-icon.${format}.js`,
      formats: ['es', 'cjs', 'system'],
    },
    rollupOptions: {
      external: ['vue'],
      output: {
        globals: {
          vue: 'Vue',
        },
      },
    },
  },
  server: {
    host: '0.0.0.0',
    cors: true,
    fs: {
      strict: false,
    },
  },
  plugins: [vue(), vueJsx(), dts()],
})
